<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="../../../js/mui.min.js"></script>
		<link href="../../../css/mui.min.css" rel="stylesheet"/>
		<script src="../../../js/world/NowWorld/main.js"></script>
		<script type="text/javascript" charset="utf-8">
		  	mui.init();
			var buttonVar = "无";
			
			setTimeout(function(){Star()},500);
			function Star(){
				document.getElementById("MyFindArea").innerHTML = plus.storage.getItem("MyFindArea");
				document.getElementById("MyCopyNum").innerHTML = plus.storage.getItem("MyCopyNum");
			}
		</script>
	</head>
	
	<body>
			<!-- 主界面菜单同时移动 -->
				<!-- 侧滑导航根容器 -->
				<div class="mui-off-canvas-wrap mui-draggable">
					<!-- 主页面容器 -->
					<div class="mui-inner-wrap">
						<!-- 菜单容器 -->
						<aside class="mui-off-canvas-left" id="offCanvasSide">
							<div class="mui-scroll-wrapper">
								<div class="mui-scroll">
									<!-- 菜单具体展示内容 -->
									<a href="../../../index.html"><button type="button" class="mui-btn mui-btn-blue mui-btn-block">回到主页</button></a>
									<a href="home.html"><button type="button" class="mui-btn mui-btn-grey mui-btn-block">自我</button></a>
									<a href="run.html"><button type="button" class="mui-btn mui-btn-grey mui-btn-block">发展</button></a>
									<a href="talk.html"><button type="button" class="mui-btn mui-btn-purple mui-btn-block">外交</button></a>
									<a href="cultrue.html"><button type="button" class="mui-btn mui-btn-grey mui-btn-block">文化</button></a>
									<a href="immortal.html"><button type="button" class="mui-btn mui-btn-grey mui-btn-block">仙魔</button></a>
								</div>
							</div>
						</aside>
						
						<header class="mui-bar mui-bar-nav"><!-- 主页面标题 -->
							<a class="mui-icon mui-action-menu mui-icon-bars mui-pull-left" href="#offCanvasSide"></a>
							<h1 class="mui-title">外交</h1>
						</header>
						<!-- 主页面内容容器 -->
						<div class="mui-content mui-scroll-wrapper">
							<div class="mui-scroll">
								<!-- 主界面具体展示内容 -->
								<ul class="mui-table-view">
									<li class="mui-table-view-cell mui-collapse">
										<a class="mui-navigate-right" href="#">探索</a>
										<div class="mui-collapse-content">
											<div class="mui-row">
												<div class="mui-col-sm-6 mui-col-xs-6"><p>探索面积</p><b id="MyFindArea">0</b></div>
												<div class="mui-col-sm-6 mui-col-xs-6"><p>秘境个数</p><b id="MyCopyNum">0</b></div>
												<div class="mui-col-sm-6 mui-col-xs-6"><button type="button" class="mui-btn mui-btn-blue mui-btn-block mui-btn-outlined">探索未知</button></div>
												<div class="mui-col-sm-6 mui-col-xs-6"><button type="button" class="mui-btn mui-btn-blue mui-btn-block mui-btn-outlined">占领空地</button></div>
											</div>
											<script>
												document.getElementsByTagName("button")[6].onclick = function(){
													if(buttonVar != "探索未知"){
														buttonVar = "探索未知";
														document.getElementById("tip1").innerHTML = "探索未知区域:需要200精力";
													}else{
														if(plus.storage.getItem("MyVim")<200){
															document.getElementById("tip1").innerHTML = "精力不够啊大佬";
															buttonVar = "无";
														}else{
															plus.storage.setItem("MyVim",String(Number(plus.storage.getItem("MyVim"))-200));
															var random = Math.floor(Math.random() * (200 + 1));
															if(random < 100){//正常无事发生
																document.getElementById("tip1").innerHTML = "这片区域没有任何危险";
																document.getElementById("tip2").innerHTML = "探索区域面积+1";
																plus.storage.setItem("MyFindArea",String(Number(plus.storage.getItem("MyFindArea"))+1));
																document.getElementById("MyFindArea").innerHTML = plus.storage.getItem("MyFindArea");
															}else if(random < 140){//小危险
																document.getElementById("tip1").innerHTML = "在这片区域遇到了危险,额外损失10精力";
																document.getElementById("tip2").innerHTML = "探索区域面积+1";
																plus.storage.setItem("MyFindArea",String(Number(plus.storage.getItem("MyFindArea"))+1));
																document.getElementById("MyFindArea").innerHTML = plus.storage.getItem("MyFindArea");
																plus.storage.setItem("MyVim",String(Number(plus.storage.getItem("MyVim"))-10));
															}else if(random < 198){//小机缘
																document.getElementById("tip1").innerHTML = "在这片区域遇到了一些机缘(获得100s的灵气)";
																document.getElementById("tip2").innerHTML = "探索区域面积+1";
																plus.storage.setItem("MyFindArea",String(Number(plus.storage.getItem("MyFindArea"))+1));
																document.getElementById("MyFindArea").innerHTML = plus.storage.getItem("MyFindArea");
																MyEnergy = Number(plus.storage.getItem("MyEnergy"));//获取当前能量
																MyEnergy += 10 * MyEnergyAdd();//灵力增加
																plus.storage.setItem("MyEnergy",String(MyEnergy));
															}else if(random < 200){//秘境
																document.getElementById("tip1").innerHTML = "在这片区域遇到了秘境!";
																document.getElementById("tip2").innerHTML = "探索区域面积+1,秘境+1";
																plus.storage.setItem("MyFindArea",String(Number(plus.storage.getItem("MyFindArea"))+1));
																document.getElementById("MyFindArea").innerHTML = plus.storage.getItem("MyFindArea");
																plus.storage.setItem("MyCopyNum",String(Number(plus.storage.getItem("MyCopyNum"))+1));
																document.getElementById("MyCopyNum").innerHTML = plus.storage.getItem("MyCopyNum");
															}
														}
													}
												}
												document.getElementsByTagName("button")[7].onclick = function(){//占领空地
													if (buttonVar!="占领空地") {
														buttonVar = "占领空地";
														document.getElementById("tip1").innerHTML = "占领空地:需要200精力,且探索面积不小于1.如果被小怪击杀会丢失寿元哦!";
													}else{
														buttonVar = "无";
														//血量设置
														if(plus.storage.getItem("MyVim")<200){
															document.getElementById("tip1").innerHTML = "精力不够啊大佬";
															return 0;
														}
														var MyHealf = Number(plus.storage.getItem("MyVita"));
														var HeHealf = 10+Number(plus.storage.getItem("MyAreaBig"))*10;
														
														var round = 0;
														document.getElementsByTagName("progress")[0].setAttribute("max",plus.storage.getItem("MyVita"));
														document.getElementsByTagName("progress")[1].setAttribute("max",String(10+Number(plus.storage.getItem("MyAreaBig"))*10));
														document.getElementsByTagName("progress")[0].setAttribute("value",plus.storage.getItem("MyVita"));
														document.getElementsByTagName("progress")[1].setAttribute("value",String(10+Number(plus.storage.getItem("MyAreaBig"))*10));
														Vita();
														function Vita(){
															setTimeout(function(){
																if(Number(plus.storage.getItem("MyDamage"))>Number(plus.storage.getItem("MyAreaBig"))/2){
																	HeHealf -= Number(plus.storage.getItem("MyDamage")) - Number(plus.storage.getItem("MyAreaBig"))/2;
																	document.getElementsByTagName("progress")[1].setAttribute("value",String(HeHealf));
																	Number(HeHealf);
																	if(0>=HeHealf){
																		plus.storage.setItem("MyFindArea",String(Number(plus.storage.getItem("MyFindArea"))-1));
																		document.getElementById("MyFindArea").innerHTML = plus.storage.getItem("MyFindArea");
																		plus.storage.setItem("MyAreaBig",String(Number(plus.storage.getItem("MyAreaBig"))+1));
																		document.getElementById("tip1").innerHTML = "战斗获胜,领地大小+1,探索面积-1";
																		return 0;
																	}
																}
																if(Number(plus.storage.getItem("MyAreaBig"))>Number(plus.storage.getItem("MyDefend"))){
																	MyHealf -= Number(plus.storage.getItem("MyAreaBig")) - Number(plus.storage.getItem("MyDefend"));
																	if(0>=MyHealf){
																		document.getElementById("tip1").innerHTML = "战斗失败";
																		plus.storage.setItem("MyAge",String(Number(plus.storage.getItem("MyAge"))-1));
																		document.getElementById("tip2").innerHTML = "寿命-1!";
																	}
																}
																round++;
																if(round === 31){
																	document.getElementById("tip2").innerHTML = "这么多个回合都打不完(你们不要再打啦.jpg)";
																	return 0;
																}
																Vita();
															},100);
														}
													}
												}
											</script>
										</div>
									</li>
									<li class="mui-table-view-cell mui-collapse">
										<a class="mui-navigate-right" href="#">关系</a>
										<div class="mui-collapse-content">
											
										</div>
									</li>
								</ul>
								<h4>提示栏:</h4>
									<p id="tip1">本页时间不进行</p>
								<h4>消息栏:</h4>
									<p id="tip2">暂无消息</p>
								<div class="mui-card">
									<!--页眉，放置标题-->
									<div class="mui-card-header"><b>战斗:</b></div>
									<!--内容区-->
									<div class="mui-card-content">
										<ul class="mui-table-view">
											<li class="mui-table-view-cell">
												我的血条:<progress value="1000" max="1000" ></progress>
											</li>
											<li class="mui-table-view-cell">
												敌方血条:<progress value="0" max="1000" style="color: red;"></progress>
											</li>
										</ul>
									</div>
								</div>
							</div>
						</div>
				   	<div class="mui-off-canvas-backdrop"></div>
					</div>
				</div>
		</body>
	
</html>